#include <iostream>
#include <vector>
using namespace std;

string longestCommonPrefix(vector<string>& strs) {
    string result = "";
    
    if (strs.empty()) {
        return result;
    }
    
    for (int i = 0; i < strs[0].length(); i++) {
        char ch = strs[0][i];
        
        for (int j = 1; j < strs.size(); j++) {
            if (i >= strs[j].length() || strs[j][i] != ch) {
                return result;
            }
        }
          
        result += ch;
    }
    
    return result;
}


int main() {
    vector<string> strs = {"flower", "flow", "flight"};
    string result = longestCommonPrefix(strs);
    cout << "The longest common prefix is: " << result << endl;

    return 0;
}